<template>
  <a-card :bordered="false">
    <a-alert :message="'完成订单数量：'+finishNum"  type="success" class="balert" />
    <a-alert :message="'交易成功订单数：'+dealNum" type="success" class="balert"  />
    <a-alert :message="'不满意退款订单数：'+refundNum" type="error" class="balert"  />
    <a-alert :message="'合作成功率：'+successRate" type="warning" class="balert"  />

  </a-card>
</template>

<script>
  import {getOrderStatistics} from "@api/api";
  import {mapGetters} from "vuex";

  export default {
    name: "Project",
    data(){
      return{
        finishNum:0,//完成订单数量
        dealNum:0,//交易成功订单数
        refundNum:0,//不满意退款订单数
        successRate:0, //合作成功率
      }
    },
    created () {
      this.getOrderSum(this.userInfo().username);
    },
    methods: {
      ...mapGetters(["userInfo"]),
      getOrderSum(username){
        let that=this;
        getOrderStatistics({username:username}).then((res)=>{
          console.log("res-->",res);
          if(res.success){
            that.finishNum=  res.result.finishNum;
            that.dealNum=  res.result.dealNum;
            that.refundNum=  res.result.refundNum;
            that.successRate=  res.result.successRate;
          }
        });
      },
    },
  }
</script>

<style scoped>
.balert{
  margin-bottom: 10px;
}
</style>